import { DtoValidation } from '@/modules/core/decorators/dto-validation.decorator';
import { Injectable } from '@nestjs/common';
import { Type } from 'class-transformer';
import { IsEnum, IsNotEmpty, IsNumber, IsOptional } from 'class-validator';
import { ORDER_STATUS } from '../contance';

@Injectable()
@DtoValidation({ type: 'body' })
export class CreateOrderDto {
  @IsEnum(ORDER_STATUS, { message: '状态不正确' })
  @IsNotEmpty({ message: '状态不能为空' })
  @IsNumber()
  @Type(() => Number)
  status: number;

  @IsNumber()
  @Type(() => Number)
  @IsOptional({ always: true })
  total_price?: number;
}
